package com.fx.test.controller;

import com.fx.demo.common.resulUtils.AjaxResult;
import com.fx.test.entity.Student;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * des:
 *
 * @author fxiao
 * @date 2020/7/8 23:15
 */
@RestController
public class TemplateHeadler {
    private final Logger log= LoggerFactory.getLogger(this.getClass());
    @Autowired
    private RestTemplate resttemplate;
    @GetMapping("student")
    public AjaxResult<List<Student>>getAllStudent(){
        AjaxResult<List<Student>> ajaxResult=resttemplate.getForEntity(
                "http://localhost:8010/eurekaclient/student?start=0&pageSize=10",
                AjaxResult.class
        ).getBody();
        return ajaxResult;
    }
}
